<template>
	<view>
		<!-- #ifndef H5 -->
		<cu-custom bgColor="bg-white" isBack="true">
			<block slot="content">扫码记录</block>
		</cu-custom>
		<!-- #endif -->
		<loading-view v-if="showLoading"></loading-view>
		<view v-show="!showLoading">

			<view class="index_b_d_aaa">
				<u-tabs ref="tabs" :current="current" @click="tabsChange" lineColor="#E71102" :activeStyle="{
							fontSize: '28rpx',
							fontFamily: 'PingFang SC',
							fontWeight: '800',
							color: '#E71102'
							}" :inactiveStyle="{
							fontSize: '28rpx',
							fontFamily: 'PingFang SC',
							color: '#333333'
							}" itemStyle="padding-left:20rpx; padding-right:20rpx; height: 80rpx;" :list="order_type" :is-scroll="false">
				</u-tabs>
			</view>
			<view class="user_withdraw_code" v-if="withdrawList.length>0">
				<view class="user_withdraw_code_a" v-for="(item, index) in withdrawList" :key="index">
					<view class="user_withdraw_code_a_a">
						<view class="user_withdraw_code_a_a_a">{{item.remark}}</view>
						<view class="user_withdraw_code_a_a_b">{{item.change_amount}}</view>
					</view>
					<view class="user_withdraw_code_a_b">
						<view class="user_withdraw_code_a_b_a">{{item.create_time}}</view>
						<view class="user_withdraw_code_a_b_b">来自用户{{item.nickname}}</view>
					</view>
				</view>
			</view>
			<loading-footer :status="status" :slot-empty="true">
				<view slot="empty" class="column-center" style="padding-top: 200rpx">
					<image class="img-null" src="/static/goods_null.png"></image>
					<text class="lighter">暂无明细记录</text>
				</view>
			</loading-footer>
		</view>
	</view>

</template>
<script>
	import request from '@/common/request.js';
	import api from '../../common/apiService';
	import {
		loadingType
	} from '@/utils/type';
	const {
		getUserIntegral
	} = api;
	export default {
		data() {
			return {
				showLoading: true,
				baseUrl_img: request.baseUrl_img,
				withdrawList: [],
				status: loadingType.LOADING,
				source_type: 0,
				user_info: [],
				page: 1,
				limit: 8,
				current: 1,
				information: {
					mid: 0,
				},
			}
		},
		onLoad(options) {
			this.source_type = options.source_type ?? '2';
		},
		onShow() {
			this.mid = uni.getStorageSync('mid');
			this.onRefresh();
		},
		onReachBottom: function() {
			this.getWithdrawFun();
		},
		mounted() {
			
		},
		methods: {
			goPage(url) {
				// if (!this.$util.isLogin()) {
				// 	return;
				// }
				uni.navigateTo({
					url
				});
			},
			navigate(url, type = 0) {
				if (!this.isLogin && type === 1) {
					return;
				}
				uni.navigateTo({
					url
				});
			},
			tabsChange(e) {
				this.current = e.index;
				this.onRefresh();
			},
			onRefresh() {
				this.page = 1
				this.withdrawList = []
				this.status = loadingType.LOADING;
				this.getWithdrawFun();
			},
			async getWithdrawFun() {
				let {
					page,
					limit,
					withdrawList,
					source_type,
					status
				} = this;
				if (status == loadingType.FINISHED) return;
				const paramsList = {
					mid: this.mid
				}
				let optsList = {
					url: 'm-ScanLogList',
					method: 'get'
				};
				request.httpRequest(optsList, paramsList).then(res => {
					if (res.data.code == 200) {
						if (page == 1) withdrawList = []
						let {
							list,
							more
						} = res.data.data
						this.withdrawList.push(...list)
						this.page = ++page
						if (!more) {
							this.status = loadingType.FINISHED
						}
						if (this.withdrawList.length <= 0) {
							this.status = loadingType.EMPTY
						}
					} else {
						this.status = loadingType.ERROR
					}
					this.showLoading = false;
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.user_withdraw_code_aa {
		width: 700rpx;
		margin: auto;
		margin-top: 20rpx;
	}

	.user_withdraw_code_aa_a {
		overflow: hidden;
	}

	.user_withdraw_code_aa_a_a {
		float: left;
		font-family: Source Han Sans;
		font-size: 28rpx;
		font-weight: normal;
		line-height: 35rpx;
		color: #3D3D3D;
	}

	.user_withdraw_code_aa_a_b {
		float: left;
		margin-left: 15rpx;
	}

	.user_withdraw_code_aa_a_c {
		font-family: 思源黑体;
		font-size: 20rpx;
		font-weight: normal;
		line-height: 35rpx;
		color: #666666;
		margin-left: 10rpx;
		float: left;
	}

	.user_withdraw_code_aa_b {
		font-family: Source Han Sans;
		font-size: 44rpx;
		font-weight: 500;
		line-height: 60rpx;
		color: #3D3D3D;
		margin-top: 20rpx;
	}

	.user_withdraw_code {
		overflow: hidden;
	}

	.user_withdraw_code_a {
		width: 702rpx;
		height: auto;
		background: #FFFFFF;
		border-radius: 20rpx;
		margin: auto;
		margin-top: 20rpx;
		overflow: hidden;
		padding: 33rpx 28rpx;
	}

	.user_withdraw_code_a_a {
		overflow: hidden;
	}

	.user_withdraw_code_a_a_a {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
		float: left;
	}

	.user_withdraw_code_a_a_b {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #DA0909;
		float: right;
	}

	.user_withdraw_code_a_b {
		overflow: hidden;
		margin-top: 20rpx;
	}

	.user_withdraw_code_a_b_a {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #666666;
		float: left;
	}

	.user_withdraw_code_a_b_b {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #BABABA;
		float: right;
	}

	.user_withdraw_code_a_c {
		margin-top: 20rpx;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FF3F4B;
	}

	.user_withdraw_code_a_c {
		height: 175rpx;
		width: 100%;
		overflow: hidden;
	}

	.user_withdraw_code_a_c_a {
		width: 175rpx;
		height: 175rpx;
	}
</style>